<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        @keyframes move {
            to {
                transform: translateX(-50%);
            }
        }
        .big-box{
            width: 16rem;
            height: 10rem;
            overflow: hidden;
            border-radius: 18px;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            background-color: #000;
        }
        .big-box:hover .rinbow-box{
            animation: move .5s linear infinite;
        }
        .rinbow-box{
            width: 200%;
            background-size: 50% 100%;
            height: 100%;
            border-radius: 18px;
            background: linear-gradient(120deg, #FF0000, #FF7F00 , #FFFF00 ,#00FF00 , #0000FF, #4B0082 , #8B00FF );
        }
        .text-box{
            width: 95%;
            height: 92%;
            border-radius: 10px;
            color: #fff;
            line-height: 140px;
            text-align: center;
            background-color: #000;
            position: relative;
            top: -50%;
            left: 50%;
            transform: translate(-50%,-50%);
        }
    </style>
</head>
<body>
    <div class="big-box">
        <div class="rinbow-box"></div>
        <div class="text-box">
            <p>
                我是一个渐变盒子动画
            </p>
        </div>
    </div>

</body>
</html>